﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcFckEditor.Models
{
    public class FckItemInfo
    {
        public string Name { get; set; }
        public string Icon { get; set; }
        public string Url { get; set; }
        public string Tip { get; set; }
        public int Height { get; set; }
        public int Width { get; set; }
        public int ThumbHeight 
        {
            get 
            {
                if (this.Height > this.Width)
                {
                    if (this.Height > 100)
                    {
                        return 100;
                    }
                    else
                    {
                        return this.Height;
                    }
                }
                else
                {
                    if (this.Width > 100)
                    {
                        return Convert.ToInt32(this.Height * (100.0 / this.Width));
                    }
                    else
                    {
                        return this.Height;
                    }
                }
            }
        }

        public int ThumbWidth
        {
            get
            {
                if (this.Width >= this.Height)
                {
                    if (this.Width > 100)
                    {
                        return 100;
                    }
                    else
                    {
                        return this.Width;
                    }
                }
                else
                {
                    if (this.Height > 100)
                    {
                        return Convert.ToInt32(this.Width * (100 / this.Height));
                    }
                    else
                    {
                        return this.Width;
                    }
                }
            }
        }
    }
}
